package tpo.vista.clientes;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

import tpo.controlador.Sistema;
import tpo.to.ClienteDTO;
import tpo.to.TipoModeloDTO;


public class BajaReserva extends JFrame {
	private Sistema sistema;
	final JFrame jframe = this;
	
	public BajaReserva(Sistema sistema){
		super("Baja Reserva");
		this.sistema = sistema;
		init();
		setVisible(true);
	}
	
	private void init(){
		setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		setLayout(new GridBagLayout());
		GridBagConstraints gc = new GridBagConstraints();

		JLabel labelNumeroReserva = new JLabel ("Numero Reserva");
		final JTextField fieldNumeroReserva = new JTextField("");
		JButton button = new JButton("Cancelar");
		
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evento) {
				try {
					sistema.cancelarReserva(Integer.parseInt(fieldNumeroReserva.getText()));
					String mensaje;
					dispose();
				} catch (Exception e) {
					System.out.println("Ocurrio un error durante la baja de reserva.");
				}
			}
		});
		
		gc.gridx = 0;	// Columna
		gc.gridy = 0;	// Fila
		add(labelNumeroReserva, gc);		
		gc.gridx = 1;
		gc.gridy = 0;
		fieldNumeroReserva.setColumns(10);
		add(fieldNumeroReserva, gc);
		
		gc.gridx = 0;
		gc.gridy = 1;
		add(button, gc);

		pack();
		setSize(400, 300);
	}

}
